<div class="row">
<div class="col-xs-12">
	<div class="box">
		<div class="box-header">
			<form id="auto-query-form" class="form-inline" method="post" role="form">
				<div class="form-group">
					<label class="control-label" for="query.keyword">关键字</label>
					<input id="query.keyword" name="query.keyword" placeholder="请输入关键字" class="form-control"/>
				</div>
				<div class="form-group">
					<label class="control-label" for="query.state">执行状态</label>
					#@dict_select("query.state","","SUCCESS_OR_FAILED",true,"执行状态","")
				</div>
				<div class="form-group">
					<label class="control-label" for="query.stime">执行时间</label>
					<input id="query.stime" name="query.stime" value="#(query.stime??)" placeholder="执行时间始" class="form-control date" datetimepicker="yyyy-mm-dd" maxlength="19"/>
					<label class="control-label" for="query.etime">至</label>
					<input id="query.etime" name="query.etime" value="#(query.etime??)" placeholder="执行时间止" class="form-control date" datetimepicker="yyyy-mm-dd" maxlength="19"/>
				</div>	
				<div class="form-group">
					#@query_btn()
				</div>
			</form>
		</div>

		<div class="box-body">
			<table id="auto_data_table" class="table table-striped table-hover table-bordered dataTable no-footer" width="100%">
			</table>
		</div>

		<div class="box-footer text-center">
			#@del_btn("log/schedule/index",true)
			#@auth_btn("clear","按条件清空","log/schedule/index",true,"btn-danger","fa fa-trash")
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
		var dtSelf = $('#auto_data_table').autoDataTable({
			controller : "log/schedule",
			title : "任务执行日志",
			columns : [
			   { "data" : "code", "name" : "code", "title" : "任务编号" },
			   { "data" : "name", "name" : "name", "title" : "任务名称" },
			   { "data" : "stime", "name" : "stime", "title" : "开始时间" },
			   { "data" : "etime", "name" : "etime", "title" : "结束时间" },
			   { "data" : "spent", "name" : "spent", "title" : "耗时（毫秒）" },
			   { "data" : "state", "name" : "state", "title" : "执行结果" , render : function(data, type, row) {
	                return dict_name("SUCCESS_OR_FAILED",data);
	            } },
			   { "data" : "server_ip", "name" : "server_ip", "title" : "服务器" }
			]
		});
		
		
		$("#clear_btn").click(function(){
			confirmDialog("<strong class='text-danger'>确定要按查询条件清空日志吗？</strong>", function() {
				var datas={keyword:jid("query.keyword").val(),stime:jid("query.stime").val(),etime:jid("query.etime").val()};
				postData("log/schedule/clear", datas, null, function(data) {
					if(data.success)dtSelf.fnDraw();
				});
			});
		});
	});
</script>